package com.duohe.demo.controller;

import com.duohe.demo.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class MVCDemoController {
    @GetMapping("/mvcDemo")
    public ModelAndView hello(){
        User user=new User();
        user.setId(123321);
        user.setName("曹鹏飞");
        user.setAge(31);

        ModelAndView modelAndView=new ModelAndView("mvcdemo");
        modelAndView.addObject("user",user);
        return  modelAndView;
    }
}
